﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Net.Sockets;

namespace ServerProject
{
    class Computer
    {
        private int com_ID;
        private string com_Name;
        private IPAddress com_IP;
        private string com_State;
        private Socket com_Soc;
        private List<FILE> files_list;
        private List<FILE> history_list;

        public Computer()
        {
            com_ID = -1;
            com_Name = "";
            com_State = "AVAILABLE";
            files_list = new List<FILE>();
            history_list = new List<FILE>();
        }

        public int Com_ID
        {
            get { return com_ID; }
            set { com_ID = value; }
        }

        public string Com_Name
        {
            get { return com_Name; }
            set { com_Name = value; }
        }

        public IPAddress Com_IP
        {
            get { return com_IP; }
            set { com_IP = value; }
        }

        public string Com_State
        {
            get { return com_State; }
            set { com_State = value; }
        }

        public Socket Com_Soc
        {
            get { return com_Soc; }
            set { com_Soc = value; }
        }

        internal List<FILE> Files_list
        {
            get { return files_list; }
            set { files_list = value; }
        }

        internal List<FILE> History_list
        {
            get { return history_list; }
            set { history_list = value; }
        }

        public int Index_of_File(int id)
        {
            foreach (FILE f in files_list)
                if (f.FileID == id) return files_list.IndexOf(f);
            return -1;
        }
    }
}
